﻿using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Bonobo.Irc.Tests
{
    [TestClass]
    public sealed class IrcStringComparerTest
    {
        [TestMethod]
        public void IrcStrComp_EqualStrings()
        {
            Assert.IsTrue(IrcStringComparer.OrdinalIgnoreCase.Equals("ABCD", "ABCD"));
        }

        [TestMethod]
        public void IrcStrComp_SameStrings()
        {
            var s = "xyz";

            Assert.IsTrue(IrcStringComparer.OrdinalIgnoreCase.Equals(s, s));
        }

        [TestMethod]
        public void IrcStrComp_XNull()
        {
            Assert.IsFalse(IrcStringComparer.OrdinalIgnoreCase.Equals(null, "a"));
        }

        [TestMethod]
        public void IrcStrComp_YNull()
        {
            Assert.IsFalse(IrcStringComparer.OrdinalIgnoreCase.Equals("b", null));
        }

        [TestMethod]
        public void IrcStrComp_BothNull()
        {
            Assert.IsTrue(IrcStringComparer.OrdinalIgnoreCase.Equals(null, null));
        }

        [TestMethod]
        public void IrcStrComp_CaseDifference()
        {
            Assert.IsTrue(IrcStringComparer.OrdinalIgnoreCase.Equals("AbCd", "aBcD"));
        }

        [TestMethod]
        public void IrcStrComp_ScandinavianCaseDifference()
        {
            Assert.IsTrue(IrcStringComparer.OrdinalIgnoreCase.Equals("{A\\b~Cd}", "[a|B^cD]"));
        }
    }
}
